﻿Imports DTO, BUS
Public Class frmxlcapnhatthedocgia


    Private _MaDocGia As String
    Public Property MaDocGia() As String
        Get
            Return _MaDocGia
        End Get
        Set(ByVal value As String)
            _MaDocGia = value
        End Set
    End Property


    Private Sub frmxlcapnhatthedocgia_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        

    End Sub

    Private Sub btnlapthe_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnlapthe.Click
        Try
            Dim sql As String = "update DOCGIA set TenDocGia = '" + txthoten.Text + "', MaLoaiDocGia = " + LookUpEdit_LoaiDocGia.EditValue.ToString() + ", "
            sql += "NgaySinh = '" + DateEditngaysinh.DateTime + "' ,DiaChi = '" + txtdiachi.Text + "' , Email = '" + txtemail.Text + "' , "
            sql += "NgayLapThe = '" + DateEditngaylapthe.DateTime + "' ,MaNhanVien = " + LookUpnguoilap.EditValue.ToString()
            sql += " where MaDocGia = " + MaDocGia

            Dim bus As New DocGiaBUS()
            Dim kq As Integer = bus.CapNhatDocGia(sql)

            If kq = 1 Then
                MessageBox.Show("Cap nhat thanh cong !")
            Else
                MessageBox.Show("Cap nhat that bai !")

            End If
        Catch ex As Exception
            MessageBox.Show("Loi! : " + ex.Message)
        End Try
    End Sub

    Private Sub btnthoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnthoat.Click
        Me.Close()
    End Sub
End Class